<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
    	
    	<report 
	       id="action_gatepass_print"
	       model="stock.picking"
	       string="Gatepass Print"
	       report_type="qweb-pdf"
	       name="batam_fast_module.ami_gatepass"
	       file="batam_fast_module.ami_gatepass"
	       groups="applico_v8.hidden_applico"
	    />
    	
    	<record id="action_gatepass_print" model="ir.actions.report.xml">
	        <field name="paperformat_id" ref="batam_fast_module.paperformat_ami_gatepass"/>
	    </record>
    	
    	<record id="stock.vpicktree" model="ir.ui.view">
            <field name="name">stock.picking.tree</field>
            <field name="model">stock.picking</field>
            <field eval="4" name="priority"/>
            <field name="arch" type="xml">
                <tree colors="blue:state == 'draft';grey:state == 'cancel';red:state not in ('cancel', 'done') and min_date &lt; current_date" string="Picking list">
                    <field name="name"/>
                    <field name="location_dest_id"/>
                    <field name="partner_id"/>
                    <field name="date"/>
                    <field name="min_date" invisible="1"/>
                    <field name="origin"/>
                    <field name="group_id" invisible="1"/>
                    <field name="backorder_id"/>
                    <field name="state"/>
                    <field name="priority" invisible="1"/>
                    <field name="picking_type_id" invisible="1"/>
                </tree>
            </field>
        </record>
		
		<record id="view_gate_pass_form_bf" model="ir.ui.view">
			<field name="name">gate.pass.form.bf</field>
			<field name="model">stock.picking</field>
			<field eval="30" name="priority"/>
			<field name="arch" type="xml">
				<form string="Gate Pass" create="0" edit="0" delete="false">
					<header>
						<button name="gatepass_print" attrs="{'invisible': [('gate_pass_state','in',['open'])]}" string="Print" type="object"/>
						<button name="action_approved_gatepass" attrs="{'invisible': [('gate_pass_state','=','approved')]}" string="Approve" type="object"/>
						<button name="action_unapproved_gatepass" attrs="{'invisible': [('gate_pass_state','=','open')]}" string="Cancel Approval" type="object"/>
						<field name="gate_pass_state" widget="statusbar" statusbar_visible="open,approved" statusbar_colors='{"open":"red","approved":"blue"}'/>
					</header>
					<sheet>
						<h1>
							<field name="name" class="oe_inline" attrs="{'invisible': [('name','=','/')]}" readonly="1"/>
						</h1>
						<group>
							<group>
								<field name="partner_id" invisible="1"/>
								<field name="project_id2" string="Project" domain="[('state','not in', ('close', 'cancelled'))]"/>
								<field name="department"/>
								<field name="requestor_id"/>
								<field name="backorder_id" attrs="{'invisible': [('backorder_id','=',False)]}"/>
								<field name="state" invisible="1"/>
							</group>
							<group>
								<field name="date"/>
								<field name="min_date" invisible="1"/>
								<field name="origin" placeholder="e.g. PO0032" class="oe_inline"/>
								<label for="owner_id" groups="stock.group_tracking_owner"/>
								<div groups="stock.group_tracking_owner">
									<field name="owner_id"/>
								</div>
							</group>
						</group>
						<notebook>
							<page string="Products">
								<separator string="Stock Moves" attrs="{'invisible': [('pack_operation_exist', '=', False)]}"/>
								<field name="move_lines" attrs="{'readonly': [('state','!=','draft')]}"/>
								<field name="pack_operation_exist" invisible="1"/>
								<field name="note" placeholder="Add an internal note..." class="oe_inline"/>
							</page>
							<page string="Gate Pass">
								<group>
									<field name="gate_pass_approver" string="Approved by"/>
									<field name="gate_pass_approver_time" string="Approval Time"/>
								</group>
							</page>
						</notebook>
					</sheet>
					<div class="oe_chatter">
						<field name="message_follower_ids" widget="mail_followers"/>
						<field name="message_ids" widget="mail_thread"/>
					</div>
				</form>
			</field>
		</record>
		
    	<record id="view_gate_pass_tree_bf" model="ir.ui.view">
            <field name="name">gate.pass.tree.bf</field>
            <field name="model">stock.picking</field>
            <field eval="9" name="priority"/>
            <field name="arch" type="xml">
                <tree string="Picking list" create="0" edit="0" delete="false">
                    <field name="name"/>
                    <field name="location_dest_id"/>
                    <field name="partner_id"/>
                    <field name="date"/>
                    <field name="min_date" invisible="1"/>
                    <field name="origin"/>
                    <field name="group_id" invisible="1"/>
                    <field name="backorder_id"/>
                    <field name="state"/>
                    <field name="priority" invisible="1"/>
                    <field name="picking_type_id" invisible="1"/>
                    <field name="gate_pass_approver_time"/>
                    <field name="gate_pass_approver"/>
                    <field name="gate_pass_state"/>
                </tree>
            </field>
        </record>
    	
    	<record id="view_gatepass_filter_bf" model="ir.ui.view">
			<field name="name">gate.pass.filter.bf</field>
			<field name="model">stock.picking</field>
			<field name="arch" type="xml">
				<search string="Search Gate Pass">
					<field name="name"/>
					<field name="gate_pass_approver"/>
					<group expand="0" string="Group By">
                        <filter string="Waiting Approval" domain="[('gate_pass_state','=','open')]" name="open_gate_pass"/>
                    </group>
				</search>
			</field>
		</record>
    	
    	<record id="action_gate_pass_bf" model="ir.actions.act_window">
			<field name="name">Gate Pass</field>
			<field name="res_model">stock.picking</field>
			<field name="type">ir.actions.act_window</field>
			<field name="domain">[('gate_pass','=',True),('state','=','done')]</field>
			<field name="view_type">form</field>
			<field name="view_mode">tree,form</field>
			<field name="search_view_id" ref="view_gatepass_filter_bf"/>
			<field name="context">{
				'search_default_open_gate_pass': 1,
			}
			</field>
			<field name="help" type="html">
				<p class="oe_view_nocontent_create">
					Click to create a new gate pass. 
				</p>
			</field>
		</record>
		
		<record id="action_gate_pass_tree_bf" model="ir.actions.act_window.view">
			<field eval="1" name="sequence"/>
			<field name="view_mode">tree</field>
			<field name="view_id" ref="view_gate_pass_tree_bf"/>
			<field name="act_window_id" ref="action_gate_pass_bf"/>
		</record>

		<record id="action_gate_pass_form_bf" model="ir.actions.act_window.view">
			<field eval="2" name="sequence"/>
			<field name="view_mode">form</field>
			<field name="view_id" ref="view_gate_pass_form_bf"/>
			<field name="act_window_id" ref="action_gate_pass_bf"/>
		</record>

        <menuitem name="Security"
            id="menu_security_root"
            sequence="71"/>
     
        <menuitem name="Security"
            id="menu_security_dept"
            parent="menu_security_root" sequence="1"/>
            
        <menuitem
            action="action_gate_pass_bf"
            id="menu_gate_pass_bf"
            parent="menu_security_dept" groups="batam_fast_module.group_security2" sequence="1"/>
    	
		<record id="view_internal_picking_form_bf" model="ir.ui.view">
			<field name="name">internal.stock.picking.form.bf</field>
			<field name="model">stock.picking</field>
			<field name="inherit_id" ref="applico_v8.view_internal_picking_form"/>
			<field name="arch" type="xml">
				<field name="partner_id" position="after">
					<field name="project_id2" string="Project" domain="[('state','not in', ('close', 'cancelled'))]"/>
					<field name="department" required="1"/>
					<field name="requestor_id"/>
				</field>
				<field name="origin" position="after">
					<field name="gate_pass"/>
					<field name="gate_pass_state" readonly="1"/>
				</field>
				<page string="Operations" position="after">
	                <page string="Terms &amp; Conditions">
						<field name="remark"/>
					</page>
                </page>  
			</field>
		</record>
		
		<record id="view_move_internal_picking_tree_bf" model="ir.ui.view">
			<field name="name">stock.move.internal.tree.bf</field>
			<field name="model">stock.move</field>
			<field name="inherit_id" ref="applico_v8.view_move_internal_picking_tree"/>
			<field name="arch" type="xml">
				<field name="product_id" position="before">
					<field name="no_stock_move"/>
				</field>
				
			</field>
		</record>
		
		<record id="view_inventory_form_applico_inherit_bf" model="ir.ui.view">
			<field name="name">view.inventory.form.applico.inherit.bf</field>
			<field name="model">stock.inventory</field>
			<field name="inherit_id" ref="applico_v8.view_inventory_form_applico"/>
			<field name="arch" type="xml">
				<field name="int_type_id" position="after">
					<field name="analytic_account_id" string="Project" readonly="1"/>
				</field>
			</field>
		</record>
		
		<record id="view_inventory_tree_inherit_bf" model="ir.ui.view">
            <field name="name">stock.inventory.tree.inherit.bf</field>
            <field name="model">stock.inventory</field>
            <field name="inherit_id" ref="stock.view_inventory_tree"/>
            <field name="arch" type="xml">
            	<field name="state" position="after">
					<field name="analytic_account_id"/>
				</field> 
            </field>
        </record>
		
    </data>
</openerp>